package com.smg.community.model;

import com.smg.community.util.StringUtil;
import java.io.PrintStream;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javacommon.base.BaseEntity;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class SmgMemberBehavior extends BaseEntity
  implements Serializable
{
  private static final long serialVersionUID = 1702993486L;
  public static final String TABLE_ALIAS = "SmgMemberBehavior";
  public static final String ALIAS_BEHAVIOR_ID = "behaviorId";
  public static final String ALIAS_MEMBER_ID = "memberId";
  public static final String ALIAS_HEAD_IMAGE = "headImage";
  public static final String ALIAS_NICK_NAME = "nickName";
  public static final String ALIAS_CONT = "cont";
  public static final String ALIAS_IMAGE = "image";
  private Integer behaviorId;
  private Integer memberId;
  private String headImage;
  private String nickName;
  private String cont;
  private String image;
  private int type;
  private int fkGroupId;
  private String groupName;
  private int createMemberId;
  private String createMemberName;
  private String sourcefrom;
  private String url;
  private int relatedId;
  private String title;
  private int commentCount;
  private float gpsLongitude;
  private float gpsLatitude;
  private String distance;
  private int age;
  private String sex;
  private String largeImage;
  private String address;
  private Date createDate;
  private String createDateString;
  private int praiseCount;
  private String contPreview;

  public String getAddress()
  {
    return this.address;
  }

  public void setAddress(String address) {
    this.address = address; }

  public  SmgMemberBehavior (){
	  
  }

  public String getLargeImage()
  {
    if (this.image != null) {
      if (this.image.indexOf("/650") != -1)
        this.largeImage = this.image.replaceAll("/650", "");

      if (this.image.indexOf("/120") != -1)
        this.largeImage = this.image.replaceAll("/120", "");

      if (this.image.indexOf("/203") != -1)
        this.largeImage = this.image.replaceAll("/203", "");

      if (this.image.indexOf("/70") != -1)
        this.largeImage = this.image.replaceAll("/70", "");
    }

    return this.largeImage;
  }

  public void setLargeImage(String largeImage) {
    this.largeImage = largeImage;
  }

  public int getAge() {
    return this.age;
  }

  public void setAge(int age) {
    this.age = age;
  }

  public String getSex() {
    return this.sex;
  }

  public void setSex(String sex) {
    this.sex = sex;
  }

  public String getDistance() {

    return this.distance;
  }

  public void setDistance(String distance) {
    this.distance = distance;
  }

  public String getCreateDateString()
  {
    DateFormat a = new SimpleDateFormat("yyyy-MM-dd");
    return a.format(getCreateDate());
  }

  public void setCreateDateString(String createDateString) {
    this.createDateString = createDateString;
  }

  public Date getCreateDate() {
    return this.createDate;
  }

  public void setCreateDate(Date createDate) {
    this.createDate = createDate;
  }

  public float getGpsLongitude() {
    return this.gpsLongitude;
  }

  public void setGpsLongitude(float gpsLongitude) {
    this.gpsLongitude = gpsLongitude;
  }

  public int getCommentCount() {
    return this.commentCount;
  }

  public void setCommentCount(int commentCount) {
    this.commentCount = commentCount;
  }

  public float getGpsLatitude() {
    return this.gpsLatitude;
  }

  public void setGpsLatitude(float gpsLatitude) {
    this.gpsLatitude = gpsLatitude;
  }

  public int getPraiseCount() {
    return this.praiseCount;
  }

  public void setPraiseCount(int praiseCount) {
    this.praiseCount = praiseCount;
  }

  public String getTitle()
  {
    return this.title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public int getRelatedId() {
    return this.relatedId;
  }

  public void setRelatedId(int relatedId) {
    this.relatedId = relatedId;
  }

  public int getType()
  {
    return this.type;
  }

  public void setType(int type) {
    this.type = type;
  }

  public int getFkGroupId() {
    return this.fkGroupId;
  }

  public void setFkGroupId(int fkGroupId) {
    this.fkGroupId = fkGroupId;
  }

  public String getGroupName() {
    return this.groupName;
  }

  public void setGroupName(String groupName) {
    this.groupName = groupName;
  }

  public int getCreateMemberId() {
    return this.createMemberId;
  }

  public void setCreateMemberId(int createMemberId) {
    this.createMemberId = createMemberId;
  }

  public String getCreateMemberName() {
    return this.createMemberName;
  }

  public void setCreateMemberName(String createMemberName) {
    this.createMemberName = createMemberName;
  }

  public String getSourcefrom() {
    if (this.sourcefrom == null)
      this.sourcefrom = "mobile";

    if (this.sourcefrom.equals("pc"))
      return "来自网页";

    return "来自手机";
  }

  public void setSourcefrom(String sourcefrom)
  {
    this.sourcefrom = sourcefrom;
  }

  public String getUrl() {
    return this.url;
  }

  public void setUrl(String url) {
    this.url = url;
  }

  public String getContPreview() {
    return this.contPreview;
  }

  public void setContPreview(String contPreview) {
    if ((!(StringUtil.isEmpty(contPreview))) && 
      (contPreview.length() > 300)) {
      contPreview = contPreview.substring(0, 299);
    }

    this.contPreview = contPreview;
  }

  public SmgMemberBehavior(Integer behaviorId)
  {
    this.behaviorId = behaviorId;
  }

  public void setBehaviorId(Integer value) {
    this.behaviorId = value;
  }

  public Integer getBehaviorId() {
    return this.behaviorId; }

  public void setMemberId(Integer value) {
    this.memberId = value;
  }

  public Integer getMemberId() {
    return this.memberId; }

  public void setHeadImage(String value) {
    this.headImage = value;
  }

  public String getHeadImage() {
    return this.headImage; }

  public void setNickName(String value) {
    this.nickName = value;
  }

  public String getNickName() {
    return this.nickName; }

  public void setCont(String value) {
    this.cont = value;
  }

  public String getCont() {
    return this.cont; }

  public void setImage(String value) {
    this.image = value;
  }

  public String getImage() {
    return this.image;
  }

  public String toString() {
    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append
      ("BehaviorId", getBehaviorId()).append
      ("MemberId", getMemberId()).append
      ("HeadImage", getHeadImage()).append
      ("NickName", getNickName()).append
      ("Cont", getCont()).append
      ("Image", getImage()).toString
      ();
  }

  public int hashCode() {
    return new HashCodeBuilder().append
      (getBehaviorId()).toHashCode
      ();
  }

  public boolean equals(Object obj) {
    if (!(obj instanceof SmgMemberBehavior)) return false;
    if (this == obj) return true;
    SmgMemberBehavior other = (SmgMemberBehavior)obj;
    return new EqualsBuilder().append
      (getBehaviorId(), other.getBehaviorId()).isEquals
      ();
  }
}